package com.tian.service.impl;

import com.tian.dto.AuthLoginDto;
import com.tian.entity.ChargeUser;
import com.tian.enums.LoginTypeEnum;
import com.tian.exception.ValidException;
import com.tian.service.AbstractLoginService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

/**
 * {@code @description:}  手机号+验证码
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-04-07 16:42
 * {@code @version:} 1.0
 */
@Service
public class PhoneCodeLoginProcessorService extends AbstractLoginService {
    @Override
    public int getLoginType() {
        return LoginTypeEnum.PHONE_CODE.getCode();
    }

    @Override
    public void validate(AuthLoginDto authLoginDto) {
        if (StringUtils.isBlank(authLoginDto.getPhone())) {
            throw new ValidException("手机号不能为空!");
        }
        if(StringUtils.isBlank(authLoginDto.getCode())){
            throw new ValidException("验证码不能为空!");
        }
    }

    @Override
    public ChargeUser doProcessor(AuthLoginDto authLoginDto) {
        return null;
    }
}
